package com.cskaoyan.controller.admin;

import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.statVo.StatGoodsVo;
import com.cskaoyan.bean.statVo.StatOrderVo;
import com.cskaoyan.bean.statVo.StatUserVo;
import com.cskaoyan.service.StatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Austin Hsu
 * @Date 2022/9/7 21:45
 */
@RestController
@RequestMapping("admin/stat")
public class StatController {

    @Autowired
    StatService statService;


    /**
     * 表market_user   {"columns":["day","users"],"rows":[{"day":"2019-04-20","users":1}]}
     *
     * @return
     */
    @RequestMapping("user")
    public BaseRespVo user() {
        StatUserVo data = statService.queryUser();
        return BaseRespVo.ok2(data);
    }


    /**
     * 表market_order_goods 1.参数add_time创建时间
     *
     * @return
     */
    @RequestMapping("order")
    public BaseRespVo order() {
        StatOrderVo data = statService.queryOrder();
        return BaseRespVo.ok2(data);
    }

    @RequestMapping("goods")
    public BaseRespVo goods() {
        StatGoodsVo data = statService.queryGoods();
        return BaseRespVo.ok2(data);
    }

}
